﻿<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
  <CustomAction
      RegistrationId="102"
      RegistrationType="List"
      Id="Wsp365.Anonymous.ListConfig.SurveySettings"
      Rights="ManageLists"
      Title="Anonymous Access"
      GroupId="SettingsMenuForSurvey"
      Location="Microsoft.SharePoint.StandardMenu"
      Sequence="1000"
      ImageUrl="/_layouts/images/securityconfig.gif">
    <UrlAction Url="javascript:SP.UI.ModalDialog.ShowPopupDialog(_spPageContextInfo.siteServerRelativeUrl + (_spPageContextInfo.siteServerRelativeUrl=='/'?'':'/') + 'ConfigPage/lists.aspx?WebUrl=' + _spPageContextInfo.webServerRelativeUrl+ '&amp;List=' + _spPageContextInfo.pageListId);"/>
  </CustomAction>
  <CustomAction
    RegistrationId="109"
    RegistrationType="List"
    Id="Wsp365.Anonymous.ListConfig.PictureSettings"
    Rights="ManageLists"
    Title="Anonymous Access"
    GroupId="ActionsMenu"
    Location="Microsoft.SharePoint.StandardMenu"
    Sequence="1000"
    ImageUrl="/_layouts/images/securityconfig.gif">
    <UrlAction Url="javascript:SP.UI.ModalDialog.ShowPopupDialog(_spPageContextInfo.siteServerRelativeUrl + (_spPageContextInfo.siteServerRelativeUrl=='/'?'':'/') + 'ConfigPage/lists.aspx?WebUrl=' + _spPageContextInfo.webServerRelativeUrl+ '&amp;List=' + _spPageContextInfo.pageListId);"/>
  </CustomAction>
  <CustomAction Id="Wsp365.Anonymous.ListConfig"
                Location="CommandUI.Ribbon"
                Rights="ManageLists"                
                Sequence="20">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Library.Settings.Controls._children">
          <Button Id="Wsp365.Anonymous.LibraryConfig.Security"
                  Command="Wsp365.Anonymous.ListConfig.Security.Command"
                  Sequence="19"
                  Image16by16="/_layouts/images/securityconfig.gif"
                  Image32by32="/_layouts/images/securityconfig.gif"
                  Description="Setup the anonymous access to this list."
                  LabelText="Anonymous Access"
                  TemplateAlias="o1"/>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.WikiPageTab.LibrarySettings.Controls._children">
          <Button Id="Wsp365.Anonymous.WikiConfig.Security"
                  Command="Wsp365.Anonymous.ListConfig.Security.Command"
                  Sequence="19"
                  Image16by16="/_layouts/images/securityconfig.gif"
                  Image32by32="/_layouts/images/securityconfig.gif"
                  Description="Setup the anonymous access to this list."
                  LabelText="Anonymous Access"
                  TemplateAlias="o1"/>
        </CommandUIDefinition>
        
        <CommandUIDefinition Location="Ribbon.Calendar.Calendar.Settings.Controls._children">
          <Button Id="Wsp365.Anonymous.CalendarConfig.Security"
                  Command="Wsp365.Anonymous.ListConfig.Security.Command"
                  Sequence="19"
                  Image16by16="/_layouts/images/securityconfig.gif"
                  Image32by32="/_layouts/images/securityconfig.gif"
                  Description="Setup the anonymous access to this list."
                  LabelText="Anonymous Access"
                  TemplateAlias="o1"/>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.List.Settings.Controls._children">
          <Button Id="Wsp365.Anonymous.ListConfig.Security"
                  Command="Wsp365.Anonymous.ListConfig.Security.Command"
                  Sequence="19"
                  Image16by16="/_layouts/images/securityconfig.gif"
                  Image32by32="/_layouts/images/securityconfig.gif"
                  Description="Setup the anonymous access to this list."
                  LabelText="Anonymous Access"
                  TemplateAlias="o1"/>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="Wsp365.Anonymous.ListConfig.Security.Command"
          CommandAction="javascript: 
           var ctx = new SP.ClientContext.get_current();    
           var listId = SP.ListOperation.Selection.getSelectedList();              
           SP.UI.ModalDialog.ShowPopupDialog(_spPageContextInfo.siteServerRelativeUrl + (_spPageContextInfo.siteServerRelativeUrl=='/'?'':'/') + 'ConfigPage/lists.aspx?WebUrl=' + _spPageContextInfo.webServerRelativeUrl+ '&amp;List=' + listId);             
            " />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>
